<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function getMaxMun(a, b) {
            if (a < b) {
                let temp = b;
                b = a;
                a = temp;
            }
            if (b === 0) {
                return a;
            }
            return getMaxMun(b, a % b);
        }
        console.log("最大公约数是："+getMaxMun(18, 30));
        console.log("最小公倍数是："+(18*30)/getMaxMun(18, 30));
    </script>
</body>

</html>